//
//  GSToast.m
//  GasStation
//
//  Created by vedon on 2/26/16.
//  Copyright © 2016 vedon. All rights reserved.
//

#import "GSToast.h"
#import "MBProgressHUD.h"
@implementation GSToast


+ (void)showToastWithText:(NSString *)text inView:(UIView *)view
{
    dispatch_async(dispatch_get_main_queue(), ^{
        [MBProgressHUD hideAllHUDsForView:view animated:NO];
        
        assert(view);
        
        MBProgressHUD *hub = [MBProgressHUD showHUDAddedTo:view animated:YES];
        hub.mode = MBProgressHUDModeText;
        hub.labelText = text;
        [hub hide:YES afterDelay:2.f];
    });
    
}

+ (void)showProgressToastInView:(UIView *)view
{
    dispatch_async(dispatch_get_main_queue(), ^{
        MBProgressHUD *hub = [MBProgressHUD showHUDAddedTo:view animated:YES];
        [hub hide:YES afterDelay:15];
    });
    
}

+ (void)hideProgressToastInView:(UIView *)view
{
    dispatch_async(dispatch_get_main_queue(), ^{
        [MBProgressHUD hideHUDForView:view animated:YES];
    });
    
}

@end
